<template>
  <div class="system-info-chart">
    <div class="system-info-title">
      <span>网络信息</span>
    </div>
    <div class="system-info-echart">
      <div style="width: 200px; height: 200px">
        <div class="net-item">
          <div class="net-tit">
            <span>上行速率</span>
          </div>
          <div class="net-arrow net-up">
            <div class="net-icon">
              <svg-icon icon-class="net_arrow_up"></svg-icon>
            </div>
            <div class="net-speed">
              <span>{{ up }}</span>
            </div>
          </div>
        </div>
        <div class="net-item">
          <div class="net-tit">
            <span>下行速率</span>
          </div>
          <div class="net-arrow net-down">
            <div class="net-icon">
              <svg-icon icon-class="net_arrow_down"></svg-icon>
            </div>
            <div class="net-speed">
              <span>{{ down }}</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { byteConvert } from "@/utils/ruoyi";

export default {
  props: {
    bytesRecv: {
      type: [String, Number],
      required: true,
    },
    bytesSent: {
      type: [String, Number],
      required: true,
    },
  },
  computed: {
    up() {
      return byteConvert(this.bytesSent);
    },
    down() {
      return byteConvert(this.bytesRecv);
    },
  },
};
</script>

<style lang="scss" scoped>
.system-info-echart {
  display: flex;
  justify-content: center;
  align-content: center;
}
.net-item {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;

  .net-tit {
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 13px;
    color: #fff;
  }

  .net-up {
    color: #519463;
  }

  .net-down {
    color: #cf1421;
  }

  .net-arrow {
    display: flex;
    align-items: center;
    .net-icon {
      font-size: 20px;
    }
    .net-speed {
      margin-left: 5px;
    }
  }
}
</style>
